package com.example.practice.example;

import com.example.practice.model.User;
import com.google.common.collect.Lists;

import java.math.BigDecimal;
import java.util.Formatter;
import java.util.List;
import java.util.stream.Collectors;

/**
 * TODO
 *
 * @author zgq
 * @date 2020/10/16 14:57
 */
public class StringFormatter {

    public static void main(String[] args) {
        List<User> users = Lists.newArrayList(
                new User(1, "name1", "gender1", 11),
                new User(2, "name2", "gender2", 12),
                new User(3, "name3", "gender3", 13));
        List<String> collect = users.stream().map(User::getName).collect(Collectors.toList());
        String string = new Formatter().format("[\"%s\",\"%s\"]", String.join(",", collect), "zhangguoqing").toString();
        System.out.println(string);

        String mo = "11";
        BigDecimal bigDecimal = new BigDecimal(mo);
        System.out.println(bigDecimal);
    }
}
